### Deployment

# Deploy translation files
qt_translations.path = $${DESTDIR}/translations
qt_translations.files = $$[QT_INSTALL_TRANSLATIONS]/qt_zh_CN.qm
INSTALLS += qt_translations

# Deploy binaries
win32 {
    DEPLOYMENT_OPTS += --force
    DEPLOYMENT_OPTS += --compiler-runtime
    DEPLOYMENT_OPTS += --no-translations
    DEPLOYMENT_OPTS += --force
    # DEPLOYMENT_OPTS += --no-svg
    # DEPLOYMENT_OPTS += --no-opengl-sw
    # DEPLOYMENT_OPTS += --no-system-d3d-compiler

    # lessThan(QT_MAJOR_VERSION, 6) {
    #     DEPLOYMENT_OPTS += --no-angle
    #     DEPLOYMENT_OPTS += --no-webkit2
    # }

    equals(TEMPLATE, app) {
        DEPLOYMENT_TARGET = $${TARGET}.exe
    }
    equals(TEMPLATE, lib) {
        DEPLOYMENT_TARGET = $${TARGET}.dll
    }

    CONFIG(debug, debug|release) {
        DEPLOYMENT_PATH = $${DESTDIR}
    }
    CONFIG(release, debug|release) {
        DEPLOYMENT_PATH = $${DESTDIR}/PACKAGE

        deploy_translations.path = $${DEPLOYMENT_PATH}/translations
        deploy_translations.files = $${qt_translations.path}/*.qm
        INSTALLS += deploy_translations

        deploy_binaries.path = $${DEPLOYMENT_PATH}
        deploy_binaries.files = $${DESTDIR}/$${DEPLOYMENT_TARGET}
        INSTALLS += deploy_binaries
    }

    windeployqt.commands = $$[QT_INSTALL_BINS]/windeployqt $${DEPLOYMENT_OPTS} $${DEPLOYMENT_PATH}/$${DEPLOYMENT_TARGET}
    windeployqt.path = $${DEPLOYMENT_PATH}
    INSTALLS += windeployqt
}
